home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / cp-80j.zip / CMDUSER.CP_ < prev    next >
Text File  |  1992-11-16  |  8KB  |  241 lines

  1. ; The AUTOEXEC section of the menu is up here, before the first menu item
  2. ; Here is a sample autoexec section
  3.  
  4.        Terminate(IsRunning(),"","")   ;Only do autoexec on 1st CmdPost
  5.           ;Run("clock.exe","")            ;sample run line
  6.  
  7. &Examples
  8.  &Run Clock           ; A simple run of an easy to find program
  9.         Run("clock.exe","")
  10.  
  11.  Excel (Microsoft)    ; A more complicated run where we employ trickery to find it
  12.         a=FileLocate("excel.exe")                       ; Try brute force path search
  13.         if a=="" then a=IniRead("extensions","xls","")  ; No? Try via [extensions] section
  14.         terminate(a=="","Error","Excel not found")      ; Not installed normally
  15.         b=strindex(a," ",0,@FWDSCAN)                    ; Find first space
  16.         if b==0 then b=strlen(a)+1                      ; None? ...adjust b
  17.         b=strsub(a,1,b-1)                               ; Pick off ^.xls stuff 
  18.         run(b,"")                                       ; Run Excel
  19.  
  20.  Excel DDE Example
  21. ;This code makes a multiplication table in Excel via DDE
  22.                                                          ; Find Excel
  23.          a=FileLocate("excel.exe")                       ; Try brute force path search
  24.          if a=="" then a=IniRead("extensions","xls","")  ; No? Try via [extensions] section
  25.          terminate(a=="","Error","Excel not found")      ; Not installed normally
  26.          b=strindex(a," ",0,@FWDSCAN)                    ; Find first space
  27.          if b==0 then b=strlen(a)+1                      ; None? ...adjust b
  28.          b=strsub(a,1,b-1)                               ; Pick off ^.xls stuff
  29.          run(b,"")                                       ; Run Excel
  30.  
  31.          channel = DDEInitiate("Excel", "Sheet1")
  32.  
  33.          Numbers="One Two Three Four Five Six Seven Eight Nine Ten"
  34.  
  35.          offset=1
  36.          row=0
  37.  
  38.          :rowloop
  39.          col=0
  40.          row=row+1
  41.          if row > 10 then goto byebye
  42.  
  43.          ThisNum=ItemExtract(row,Numbers," ")
  44.          title=row+offset
  45.          DDEPoke(channel, "R1C%title%", ThisNum)
  46.          DDEPoke(channel, "R%title%C1", ThisNUm)
  47.  
  48.          :colloop
  49.          col=col+1
  50.          if col > 10 then goto rowloop
  51.  
  52.          expression="=%row%*%col%"
  53.          address=strcat("R",row+offset,"C",col+offset)
  54.          DDEPoke(channel,address,expression)
  55.          goto colloop
  56.  
  57.          :byebye
  58.          DDETerminate(channel)
  59.  
  60.  
  61.  Days between today and ???
  62.         ;First convert todays date to Julian Equivalent
  63.          
  64.         ; extracts separate M, D, and Y variables from DateTime string
  65.         ; assumes international date format is standard U.S. (MM/DD/YY)
  66.  
  67.         dt1 = strtrim(DateTime())
  68.         dt = ItemExtract(3,dt1," ")
  69.         if dt=="" then dt=ItemExtract(2,dt1," ")
  70.         dm = ItemExtract(1,dt,"/")
  71.         dd = ItemExtract(2,dt,"/")
  72.         dy = ItemExtract(3,dt,"/")
  73.  
  74.         ; performs the actual conversion
  75.         dm = dm + 9
  76.         dy = dy + dm / 12 + 399
  77.         dm = dm mod 12
  78.         today = dy * 365 + dy / 4 - dy / 100 + dy / 400 + (153 * dm + 2) / 5 + dd - 146037
  79.         xt=strtrim(AskLine("Day Counter","Enter target date",dt))
  80.  
  81.         xm = ItemExtract(1,xt,"/")
  82.         xd = ItemExtract(2,xt,"/")
  83.         xy = ItemExtract(3,xt,"/")
  84.  
  85.         ; performs the actual conversion
  86.         xm = xm + 9
  87.         xy = xy + xm / 12 + 399
  88.         xm = xm mod 12
  89.         other = xy * 365 + xy / 4 - xy / 100 + xy / 400 + (153 * xm + 2) / 5 + xd - 146037
  90.         diff=abs(today-other);
  91.         Message("Day Counter","%dt% <=> %xt%%CR%Are %diff% days apart")
  92.         drop(dt,dm,dd,dy,xm,xd,xy,xt,today,other,diff,dt1)
  93.  
  94.  Sound Tricks
  95.   Play WAV file
  96.         a=CurrentFile()
  97.         if FileExtension(a)=="WAV" then goto play
  98.         a=FileItemize("*.wav")
  99.         if a!="" then goto sel
  100.         dirchange(DirWindows(0))        ; Where ever you hide your main wav files
  101.         a=fileitemize("*.wav")
  102.         :sel
  103.         a=itemselect("Waveform",a," ")
  104.         if a=="" then exit
  105.         :play
  106.         playwaveform(a,1)
  107.  
  108.   Play whole dir of wav files
  109.         old=Sounds(0)
  110.         a=FileItemize("*.WAV")
  111.         if a=="" then goto oop
  112.         count=itemcount(a,' ')
  113.         index=0
  114.         :loop
  115.         index=index+1
  116.         if index>count then goto zoop
  117.         b=itemextract(index,a,' ')
  118.         playwaveform(b,1)
  119.         display(3,index,b)
  120.         goto loop
  121.         :oop
  122.         message("???","No wav files in directory")
  123.         :zoop
  124.         sounds(old)
  125.  
  126.   Play MID or RMI file
  127.         a=CurrentFile()
  128.         if (FileExtension(a)=="MID" || FileExtension(a)=="RMI") then goto play
  129.         a=FileItemize("*.mid *.rmi")
  130.         if a!="" then goto sel
  131.         dirchange(DirWindows(0))        ; Where ever you hide your main mid/rmi files
  132.         a=fileitemize("*.mid")
  133.         :sel
  134.         a=itemselect("MIDI Player",a," ")
  135.         if a=="" then exit
  136.         :play
  137.         a=strcat(DirGet(),a)
  138.         playmidi(a,1)
  139.  
  140.   Play a CD
  141.         PlayMedia("open cdaudio shareable alias donna notify")
  142.         PlayMedia("set donna time format tmsf")
  143.         PlayMedia("play donna from 1")
  144.         PlayMedia("close donna")
  145.  
  146.  
  147. &SubDirs
  148.  &Windows
  149.        DirChange(DirWindows(0))
  150.        SetDisplay("","","")   ;The setdisplay stmt locks in the current dir
  151.  &DOS
  152.        DirChange("C:\DOS")
  153.        SetDisplay("","","") 
  154.  &TEMP
  155.        DirChange(Environment("TEMP"))
  156.        SetDisplay("","","")
  157.  
  158. &Clipboarding
  159.  Path and Filename to Clipboard
  160.         Clipput(strcat(DirGet(),CurrentFile()))
  161.  Copy &Directory to Clipboard
  162.     a=FileItemize("*.*")
  163.         a=StrReplace(a," ",cr)
  164.     ClipPut(a)
  165.     Drop(a)
  166.  Copy &Hilited files to Clipboard
  167.     a=FileItemize("")
  168.         a=StrReplace(a," ",cr)
  169.     ClipPut(a)
  170.     Drop(a)
  171.  Copy &Special Characters to Clipboard
  172.        a=" í| ó| ú| ñ| Ñ| ª| º| ¿| ⌐| ¬|"       ;161 thru 170
  173.        b=" ½| ¼| ¡| «| »| ░| ▒| ▓| │| ┤|"       ;171 thru 180
  174.        c=" ╡| ╢| ╖| ╕| ╣| ║| ╗| ╝| ╜| ╛|"       ;181 thru 190
  175.        d=" ┐| └| ┴| ┬| ├| ─| ┼| ╞| ╟| ╚|"       ;191 thru 200
  176.        e=" ╔| ╩| ╦| ╠| ═| ╬| ╧| ╨| ╤| ╥|"       ;201 thru 210
  177.        f=" ╙| ╘| ╒| ╓| ╫| ╪| ┘| ┌| █| ▄|"       ;211 thru 220
  178.        g=" ▌| ▐| ▀| α| ß| Γ| π| Σ| σ| µ|"       ;221 thru 230
  179.        h=" τ| Φ| Θ| Ω| δ| ∞| φ| ε| ∩| ≡|"       ;231 thru 240
  180.        i=" ±| ≥| ≤| ⌠| ⌡| ÷| ≈| °| ∙| ·|"       ;241 thru 250
  181.        j=" √| ⁿ| ²| ■|  "                       ;251 thru 255
  182.        a=strcat(a,b,c,d,e,f,g,h,i,j)
  183.        Drop(b,c,d,e,f,g,h,i,j)
  184.        a=ItemSelect("Choose a character",a,"|")
  185.        a=strsub(a,2,1)
  186.        ClipPut(a)
  187.        Drop(a)
  188.  _Start &Clipboard
  189.         errormode(@off)
  190.         terminate(winactivate("Clipboard"),"","") ;Already Running
  191.         errormode(@cancel)
  192.         run("Clipbrd.exe","")
  193.  
  194. ZIP
  195.  Zip Current File
  196.   Keep Current File
  197.         call("wwwmenus.dll","zip current keep")
  198.   Move File to Zip
  199.         call("wwwmenus.dll","zip current move")
  200.  
  201.  Zip Directory
  202.   Keep Files
  203.         call("wwwmenus.dll","zip dir keep")
  204.   Move Files to Zip
  205.         call("wwwmenus.dll","zip dir move")
  206.  
  207.  Zip Directory and Subdirs
  208.   Keep Files
  209.         call("wwwmenus.dll","zip subdir keep")
  210.   Move Files to Zip
  211.         call("wwwmenus.dll","zip subdir move")
  212.  
  213.  Zip Hilited Files
  214.   Keep Files
  215.         call("wwwmenus.dll","zip hilited keep")
  216.   Move Files to Zip
  217.         call("wwwmenus.dll","zip hilited move")
  218.  
  219.  
  220.  _UnZip
  221.   All files
  222.    Into Current Dir
  223.         call("wwwmenus.dll","unzip all 1")
  224.    Specify Options
  225.         call("wwwmenus.dll","unzip all 2")
  226.   Individual
  227.    Into Cur Dir/Overwrite
  228.         call("wwwmenus.dll","unzip indiv 1")
  229.    Specify Options
  230.         call("wwwmenus.dll","unzip indiv 2")
  231.  
  232.  _&View contents
  233.   By &Name
  234.         call("wwwmenus.dll","unzip view 1")
  235.   By &Extension
  236.         call("wwwmenus.dll","unzip view 2")
  237.   By &Date
  238.         call("wwwmenus.dll","unzip view 3")
  239.   By &Size
  240.         call("wwwmenus.dll","unzip view 4")
  241.